/*************************************************************************
 *  Copyright © 2023-2030 FXB CO.,LTD. All rights reserved.
 *------------------------------------------------------------------------
 *  公司：DefaultCompany
 *  项目：UPMProject
 *  文件：PackageResourceManage.cs
 *  作者：Administrator
 *  日期：2025/7/25 17:20:20
 *  功能：Nothing
*************************************************************************/

using System.Collections;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;

namespace SVNPackageManager.Runtime
{
    [System.Serializable]
    public class PackageResourceManage
    {
        public GUIContent settingsIcon;
        public Texture2D refreshIcon;
        public Texture2D rotateRefreshIcon;
        public Texture2D upgradeIcon;

        public ScopedRegistryConfig svnScopedRegistryConfig;
        public PackageListCache packageListCache;

        public void InitResource()
        {
#if UNITY_EDITOR
            GetPackageIcons();
#endif
            LoadConfigResources();
        }

#if UNITY_EDITOR
        /// <summary>
        /// 获取图标资源
        /// </summary>
        private void GetPackageIcons()
        {
            settingsIcon = EditorGUIUtility.IconContent("SettingsIcon");
            refreshIcon = EditorGUIUtility.IconContent("d_Refresh").image as Texture2D;
            upgradeIcon = Resources.Load("Icons/Upgrade") as Texture2D;
            rotateRefreshIcon = Resources.Load("Icons/Refresh") as Texture2D;
        }
#endif
        /// <summary>
        /// 加载配置资源
        /// </summary>
        private void LoadConfigResources()
        {
            svnScopedRegistryConfig = Resources.Load<ScopedRegistryConfig>("ScopedRegistryConfig");
            packageListCache = Resources.Load<PackageListCache>("PackageListCache");
        }
    }
}


